package Threading2;

// 第一种创建线程的方式：重写Thread类中的run方法

class MyThread extends Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("hello world!!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

public class ThreadingDemo1 {

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();
//        int i = 3;
        while (true) {
            System.out.println("hello hiiiiii");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
